#!/bin/bash
#

if [ -z $1 ];then
   echo "请输入以下参数: $0<IO|SQL>"
   exit 2
fi

user=root
password=WWW.1.com

state=$(mysql -u${user} -p${password} -e "show slave status\G" 2> /dev/null | grep -w "Slave_${1}_Running" | awk '{print $2}')

if [ "${state}" = "Yes" ];then
   echo "正常运行"
else
   echo "异常"
fi
